'use strict';

angular.module('app')

  .controller('DetailedInfoCtrl', [ '$scope', '$routeParams', 'growl', 'svcState', function ($scope, $routeParams, growl, svcState) {

    if(!svcState.isLoggedIn()) {
        svcState.gotoLogin();
        return;
    }

    svcMain.detailedInfo($routeParams.memberId).then(function() {
        if (resp.statusCode) {
            if (resp.statusCode == 'SUCCESS') {
                $scope.member = resp.object;
            }
            else if (resp.statusCode == 'ERROR_LOGIN_REQUIRED') {
                svcState.gotoLogin();
            }
            else {
                growl.error(resp.statusCode + (resp.userFriendlyMessage ? ': ' + resp.userFriendlyMessage : ''));
            }
            $scope.$apply();
        } else {
            growl.error('Invalid response from Server');
        }
    });

  }])

;

